package com.huawei.appmarket.service.appdetail.view.fragment;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.huawei.appgallery.appcomment.api.AppCommentFragmentProtocol;
import com.huawei.appgallery.forum.section.api.IAppDetailSectionProtocol;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSSelector;
import com.huawei.appgallery.foundation.ui.css.CSSStyleSheet;
import com.huawei.appgallery.foundation.ui.css.CSSView;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.uikit.ContractFragment;
import com.huawei.appgallery.foundation.ui.framework.widget.BounceViewPager;
import com.huawei.appmarket.framework.AppDetailActivity;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailColumnTabBean;
import com.huawei.appmarket.service.appdetail.view.AppDetailFragmentProtocol;
import com.huawei.appmarket.service.appdetail.view.AppDetailFragmentProtocol.Request;
import com.huawei.appmarket.service.appdetail.view.card.DetailDownloadCard;
import com.huawei.appmarket.service.appdetail.view.card.DetailHeadCard;
import com.huawei.appmarket.service.appdetail.view.widget.DetailSubTabWidget;
import com.huawei.appmarket.service.appdetail.view.widget.NestScrollLayout;
import com.huawei.appmarket.service.appdetail.view.widget.NestScrollLayout.a;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant.KeyAndValue;
import com.huawei.hwid.core.constants.HwAccountConstants;
import com.huawei.secure.android.common.intent.SafeIntent;
import huawei.widget.HwSubTabWidget;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import o.bwz;
import o.cdb;
import o.cdg;
import o.cgo;
import o.chb;
import o.chp;
import o.cin;
import o.cio;
import o.ciy;
import o.ciz;
import o.cjb;
import o.cjk;
import o.cjm;
import o.cjo;
import o.cju;
import o.SomeFragmentStateAdapter;
import o.cki;
import o.dgh;
import o.dgm;
import o.dhr;
import o.dke;
import o.dmi;
import o.dmq;
import o.Logger;
import o.dof;
import o.ContentManager;
import o.drk;
import o.drn;
import o.dro;
import o.drr;
import o.drt;
import o.drv;
import o.drw;
import o.dry;
import o.duk;
import o.dvq;
import o.eoj;
import o.epr;
import o.epv;
import o.CollectCheck;
import o.ety;
import o.MinimumFactory;
import o.evr;
import o.ewm.h;
import o.ewm.j;
import o.ewm.n;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjm;
import o.FragmentManager;
import o.FragmentTransaction;
import o.ll;

public class AppDetailFragment extends TaskFragment<AppDetailFragmentProtocol> implements cki, drt, a, drv, huawei.widget.HwSubTabWidget.b {
    private int ʹ = 0;
    private NestScrollLayout ʻˊ;
    private View ʻˋ;
    private LinearLayout ʻᐝ = null;
    private b ʼ;
    private LinearLayout ʼˊ = null;
    private LinearLayout ʼˋ = null;
    private Request ʼᐝ = null;
    private BounceViewPager ʽ;
    private ViewGroup ʽˊ;
    private ViewGroup ʽˋ;
    private LinkedHashMap<Integer, drr> ʽᐝ = new LinkedHashMap();
    private LayoutInflater ʾॱ;
    private dhr ʿॱ;
    private final BroadcastReceiver ˈॱ = new BroadcastReceiver(this) {
        final /* synthetic */ AppDetailFragment ॱ;

        {
            this.ॱ = r1;
        }

        public void onReceive(Context context, Intent intent) {
            if ("com.huawei.appmarket.service.broadcast.CommentAdded".equals(intent.getAction())) {
                String stringExtra = intent.getStringExtra("ACTION_PARAM_COMMENT_ADDED_TYPE_APPID");
                CharSequence stringExtra2 = intent.getStringExtra("ACTION_PARAM_COMMENT_ADDED_TYPE_CONTENT");
                if (!(this.ॱ.ʼᐝ.ˊ() == null || this.ॱ.ʼᐝ.ˊ().ͺˏ() == null || !this.ॱ.ʼᐝ.ˊ().ͺˏ().equals(stringExtra) || TextUtils.isEmpty(stringExtra2) || this.ॱ.ॱॱ == null || this.ॱ.ʽ == null)) {
                    for (int i = 0; i < this.ॱ.ʼᐝ.ॱ().size(); i++) {
                        if ("comment".equals(cju.ˋ(((DetailColumnTabBean) this.ॱ.ʼᐝ.ॱ().get(i)).ॱ()))) {
                            this.ॱ.ॱॱ.setSubTabSelected(i);
                            this.ॱ.ʽ.setCurrentItem(i);
                        }
                    }
                }
            }
            for (drn ˏ : this.ॱ.ˊ) {
                ˏ.ˏ(context, new SafeIntent(intent));
            }
        }
    };
    private WeakReference<Fragment> ˉॱ;
    private final List<drn> ˊ = new ArrayList();
    private View ˊʻ;
    private int ˊʼ;
    private final BroadcastReceiver ˋ = new BroadcastReceiver(this) {
        final /* synthetic */ AppDetailFragment ˎ;

        {
            this.ˎ = r1;
        }

        public void onReceive(Context context, Intent intent) {
            for (drn ˏ : this.ˎ.ˊ) {
                ˏ.ˏ(context, new SafeIntent(intent));
            }
        }
    };
    protected long ˎ;
    private DetailHeadCard ˏ;
    private final BroadcastReceiver ॱ = new BroadcastReceiver(this) {
        final /* synthetic */ AppDetailFragment ॱ;

        {
            this.ॱ = r1;
        }

        public void onReceive(Context context, Intent intent) {
            if (this.ॱ.ˏ != null) {
                this.ॱ.ˏ.ˏ(context, new SafeIntent(intent));
            }
        }
    };
    private DetailSubTabWidget ॱॱ;
    private DetailDownloadCard ᐝ;
    private drr ﹳ;
    private com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b ﾞ;
    private int ﾟ;

    class b extends SomeFragmentStateAdapter {
        private WeakReference<AppDetailActivity> ˊ;
        private Fragment ˏ;
        final /* synthetic */ AppDetailFragment ॱ;

        public b(AppDetailFragment appDetailFragment, FragmentManager juVar) {
            this.ॱ = appDetailFragment;
            super(juVar);
        }

        public Fragment getItem(int i) {
            String ˎ;
            Fragment ˏ;
            duk o_duk = new duk();
            String ॱ = this.ॱ.ॱ(n.ˋߴ);
            if (this.ॱ.ʼᐝ.ˎ() != null) {
                ˎ = this.ॱ.ʼᐝ.ˎ();
            } else {
                ˎ = ॱ;
            }
            String ॱ2 = ((DetailColumnTabBean) this.ॱ.ʼᐝ.ॱ().get(i)).ॱ();
            ॱ = ((DetailColumnTabBean) this.ॱ.ʼᐝ.ॱ().get(i)).ˊ();
            o_duk.ʽ(ॱ2);
            o_duk.ˋ(ॱ);
            o_duk.ˏ(null);
            o_duk.ˎ(ˎ);
            o_duk.ˋ(ॱ2.hashCode());
            o_duk.ˊ(this.ॱ.ʼᐝ.ˋ());
            o_duk.ʼ(this.ॱ.ʼᐝ.ˊ().ॱـ());
            o_duk.ॱॱ(this.ॱ.ʼᐝ.ˊ().ͺˏ());
            o_duk.ˎ(this.ॱ.ʼᐝ.ˊ().ˊ());
            o_duk.ᐝ(this.ॱ.ʼᐝ.ˊ().ʽ());
            o_duk.ॱ(this.ॱ.ʼᐝ.ˊ().ꜞ());
            o_duk.ʻ(this.ॱ.ʼᐝ.ʻ());
            o_duk.ॱˊ(this.ॱ.ʼᐝ.ʽ());
            o_duk.ॱ(this.ॱ.ʼᐝ.ʼ());
            o_duk.ˊ(chb.SECONDARY_LIST_TAB);
            if ("comment".equals(cju.ˋ(ॱ2))) {
                if (fho.ˏ().ˋ("AppComment") != null) {
                    cjo appCommentFragmentProtocol = new AppCommentFragmentProtocol();
                    AppCommentFragmentProtocol.Request request = new AppCommentFragmentProtocol.Request();
                    request.ॱ(this.ॱ.ʼᐝ.ˊ().ͺˏ());
                    request.ˎ(this.ॱ.ʼᐝ.ʻ());
                    request.ˏ(this.ॱ.ʼᐝ.ʽ());
                    request.ˋ(this.ॱ.ʼᐝ.ˊ().ʽ());
                    request.ॱ(this.ॱ.ʼᐝ.ʼ());
                    appCommentFragmentProtocol.ˎ(request);
                    return cjk.ˎ().ˊ(new cjm("appcomment.fragment", appCommentFragmentProtocol));
                }
            } else if (ॱ2.startsWith("forum|forum_detail_app")) {
                fjb ˎ2 = fho.ˏ().ˋ("Section").ˎ("AppDetailSectionFragment");
                if (ˎ2 != null) {
                    IAppDetailSectionProtocol iAppDetailSectionProtocol = (IAppDetailSectionProtocol) ˎ2.ˊ();
                    iAppDetailSectionProtocol.setUri(ॱ2);
                    iAppDetailSectionProtocol.setFragmentID(o_duk.ˏ());
                    iAppDetailSectionProtocol.setStyle(o_duk.ʻ());
                    iAppDetailSectionProtocol.setCssSelector(o_duk.ॱॱ());
                    iAppDetailSectionProtocol.setCss(o_duk.ʼ());
                    iAppDetailSectionProtocol.setAppId(this.ॱ.ʼᐝ.ˊ().ͺˏ());
                    ˏ = fjm.ˏ(fiu.ˊ().ˋ(this.ॱ.ॱˊ(), ˎ2)).ˏ();
                    this.ॱ.ˉॱ = new WeakReference(ˏ);
                    this.ॱ.ˊʼ = i;
                    return ˏ;
                }
            }
            cjm ॱ3 = dro.ॱ(ॱ2, o_duk);
            if (ॱ3 != null) {
                ˏ = (ContractFragment) cjk.ˎ().ˊ(ॱ3);
                drw o_drw = (drw) ˏ.ˊ(drw.class);
                if (o_drw != null) {
                    o_drw.ˏ(this.ॱ.ʽᐝ);
                }
                if (ˏ.ˊ(cio.class) != null) {
                    ((cio) ˏ).ॱ(this.ॱ.ʽ);
                }
                if (ˏ.ˊ(cin.class) != null && ॱ2.startsWith("introduce")) {
                    ((cin) ˏ).ॱ(this.ॱ.ﾞ);
                }
            } else {
                ˏ = null;
            }
            Logger.ˎ("AppDetailFragment", "getItem, position:" + i + ", Fragment:" + ˏ);
            if (ˏ == null) {
                return new ContractFragment();
            }
            return ˏ;
        }

        public void finishUpdate(ViewGroup viewGroup) {
            if (this.ˊ == null) {
                super.finishUpdate(viewGroup);
                return;
            }
            AppDetailActivity appDetailActivity = (AppDetailActivity) this.ˊ.get();
            if (appDetailActivity != null && !appDetailActivity.ॱˊ() && !appDetailActivity.isFinishing()) {
                super.finishUpdate(viewGroup);
            }
        }

        public int getCount() {
            return this.ॱ.ॱॱ.ॱ();
        }

        public void ˎ(AppDetailActivity appDetailActivity) {
            this.ˊ = new WeakReference(appDetailActivity);
        }

        public void setPrimaryItem(ViewGroup viewGroup, int i, Object obj) {
            super.setPrimaryItem(viewGroup, i, obj);
            Fragment fragment = (Fragment) obj;
            if (fragment != this.ˏ) {
                if (fragment instanceof ciy) {
                    ((ciy) fragment).ˋ(i);
                }
                if (this.ˏ instanceof ciy) {
                    ((ciy) this.ˏ).ʽˊ();
                }
                this.ˏ = fragment;
            }
        }

        public Fragment ˊ() {
            return this.ˏ;
        }
    }

    static class d implements ViewPager.OnPageChangeListener {
        private int ˊ = 0;
        private AppDetailFragment ˎ;
        private WeakReference<HwSubTabWidget> ˏ;

        public d(HwSubTabWidget hwSubTabWidget, AppDetailFragment appDetailFragment) {
            this.ˏ = new WeakReference(hwSubTabWidget);
            this.ˎ = appDetailFragment;
        }

        public void onPageScrolled(int i, float f, int i2) {
            if (this.ˏ != null) {
                HwSubTabWidget hwSubTabWidget = (HwSubTabWidget) this.ˏ.get();
                if (hwSubTabWidget != null) {
                    hwSubTabWidget.setSubTabScrollingOffsets(i, f);
                }
            }
        }

        public void onPageScrollStateChanged(int i) {
            if (this.ˏ != null) {
                HwSubTabWidget hwSubTabWidget = (HwSubTabWidget) this.ˏ.get();
                if (hwSubTabWidget != null) {
                    hwSubTabWidget.setSubTabSelected(i);
                }
                if (this.ˎ != null) {
                    this.ˎ.ˏ(this.ˊ, i);
                    this.ˊ = i;
                }
            }
            if (this.ˎ != null) {
                this.ˎ.ʻ(i);
            }
        }

        public void onPageScrolled(int i) {
        }
    }

    class e implements dmi {
        final /* synthetic */ AppDetailFragment ˎ;

        private e(AppDetailFragment appDetailFragment) {
            this.ˎ = appDetailFragment;
        }

        public void run() {
            for (int i = 0; i < this.ˎ.ʼᐝ.ॱ().size(); i++) {
                if ("recommend".equals(cju.ˋ(((DetailColumnTabBean) this.ˎ.ʼᐝ.ॱ().get(i)).ॱ()))) {
                    this.ˎ.ॱॱ.setSubTabSelected(i);
                    if (this.ˎ.ʽ != null) {
                        this.ˎ.ʽ.setCurrentItem(i);
                        return;
                    }
                    return;
                }
            }
        }
    }

    public void ˋ(drr o_drr) {
        this.ﹳ = o_drr;
        this.ʽᐝ.put(Integer.valueOf(1), o_drr);
    }

    public void ॱ(com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b bVar) {
        this.ﾞ = bVar;
    }

    public void ˎ(drr o_drr) {
        ˉॱ();
        if (o_drr.ˊ() != null) {
            this.ʼᐝ = o_drr.ˊ();
            if (this.ʽˋ != null && this.ʾॱ != null && this.ʽˊ != null) {
                ˈॱ();
                ˏ(this.ʽˋ, this.ʾॱ, this.ʽˊ, null);
            }
        }
    }

    public void ˏ(Bundle bundle) {
        AppDetailFragmentProtocol appDetailFragmentProtocol = (AppDetailFragmentProtocol) ˆ();
        if (appDetailFragmentProtocol == null || appDetailFragmentProtocol.ˏ() == null) {
            this.ʼᐝ = new Request();
        } else {
            this.ʼᐝ = appDetailFragmentProtocol.ˏ();
        }
        ˈॱ();
        if (this.ʿॱ != null) {
            this.ʿॱ.ॱ(this.ʼᐝ.ʼ(), CSSStyleSheet.parse(this.ʼᐝ.ʻ()), this.ʼᐝ.ʽ());
        }
        if (bundle != null) {
            this.ˊʼ = bundle.getInt("extend_fragment_position");
        }
        super.ˏ(bundle);
    }

    private void ˈॱ() {
        if (!CollectCheck.isEmpty(this.ʼᐝ.ॱ()) && this.ʼᐝ.ˊ() != null && this.ʼᐝ.ˏ() != null) {
            if (!this.ʼᐝ.ˋॱ()) {
                ॱˋ(true);
            }
            if (this.ʼᐝ.ॱ().get(0) != null && !this.ʼᐝ.ˋॱ()) {
                DetailColumnTabBean detailColumnTabBean = (DetailColumnTabBean) this.ʼᐝ.ॱ().get(0);
                ॱ(detailColumnTabBean.ॱ(), detailColumnTabBean.ˋ());
                ˊ(this.ʼᐝ.ˊ().ͺˏ(), ((DetailColumnTabBean) this.ʼᐝ.ॱ().get(0)).ॱ());
            }
        }
    }

    public View ˋ(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        CharSequence ॱ = ॱ(n.ˋߴ);
        this.ʾॱ = layoutInflater;
        this.ʽˊ = viewGroup;
        if (this.ʼᐝ.ˎ() != null) {
            ॱ = this.ʼᐝ.ˎ();
        }
        ॱˋ().setTitle(ॱ);
        this.ʽˋ = (ViewGroup) layoutInflater.inflate(h.ʽॱ, viewGroup, false);
        ˏ(this.ʽˋ, layoutInflater, viewGroup, bundle);
        eoj.ˋ().ˎ("APP_DETAIL_LOGIN_KEY", drk.ˏ());
        ॱˋ().registerReceiver(this.ˋ, new IntentFilter(dvq.ˊ()));
        IntentFilter intentFilter = new IntentFilter(bwz.ˎ);
        IntentFilter intentFilter2 = new IntentFilter("com.huawei.appmarket.service.broadcast.CommentAdded");
        intentFilter2.addAction("com.huawei.appmarket.service.broadcast.LoginForDetail");
        ll ˏ = ll.ˏ(ॱˋ());
        ˏ.ˏ(this.ˈॱ, intentFilter2);
        ˏ.ˏ(this.ॱ, intentFilter);
        return this.ʽˋ;
    }

    private void ˋ(View view) {
        if (this.ʼᐝ.ʻ() != null && this.ʼᐝ.ʽ() != null) {
            CSSRule rule = new CSSSelector(this.ʼᐝ.ʽ()).getRule(CSSStyleSheet.parse(this.ʼᐝ.ʻ()).getRootRule());
            if (rule != null) {
                CSSView.wrap(view, rule).render();
            }
        }
    }

    private CSSMonoColor ˎ(CSSRule cSSRule, String str, String str2) {
        CSSRule rule = new CSSSelector(str).getRule(cSSRule);
        if (rule == null || rule.getStyleDeclaration() == null) {
            return null;
        }
        CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(str2);
        return propertyValue instanceof CSSMonoColor ? (CSSMonoColor) propertyValue : null;
    }

    public void ˏ(ViewGroup viewGroup, LayoutInflater layoutInflater, ViewGroup viewGroup2, Bundle bundle) {
        dke o_dry;
        LinearLayout linearLayout = (LinearLayout) viewGroup.findViewById(j.ॱᵔ);
        this.ˊʻ = viewGroup.findViewById(j.ॱˆ);
        linearLayout.removeAllViews();
        this.ˏ = new DetailHeadCard();
        this.ˏ.ˏ(this);
        View ˊ = this.ˏ.ˊ(layoutInflater, viewGroup2, bundle);
        if (this.ʼᐝ.ʼ() == 1 && dof.ᐝ(this.ʼᐝ.ʻ()) && this.ʼᐝ.ʽ() != null) {
            CSSRule rule = new CSSSelector(this.ʼᐝ.ʽ()).getRule(CSSStyleSheet.parse(this.ʼᐝ.ʻ()).getRootRule());
            if (rule != null) {
                int color;
                int color2;
                CSSMonoColor ˎ = ˎ(rule, ".body", CSSPropertyName.BACKGROUND_COLOR);
                if (ˎ != null) {
                    this.ﾟ = ˎ.getColor();
                    this.ˏ.ॱ(this.ﾟ);
                }
                ˎ = ˎ(rule, ".widget", CSSPropertyName.BACKGROUND_TINT);
                if (ˎ != null) {
                    color = ˎ.getColor();
                } else {
                    color = 0;
                }
                CSSMonoColor ˎ2 = ˎ(rule, ".detail-download-button", CSSPropertyName.FONT_COLOR);
                if (ˎ2 != null) {
                    color2 = ˎ2.getColor();
                } else {
                    color2 = 0;
                }
                if (!(color == 0 || color2 == 0)) {
                    o_dry = new dry(ॱˋ(), color, color2);
                    if (CollectCheck.isEmpty(this.ʼᐝ.ॱ())) {
                        ˎ(viewGroup);
                        ˎ(viewGroup, this.ʼᐝ.ॱ().size());
                        if (this.ʼᐝ.ˋॱ()) {
                            ˉॱ();
                            ॱ(viewGroup);
                        } else {
                            ˊʻ();
                        }
                        this.ʼˋ = (LinearLayout) viewGroup.findViewById(j.ˋﾞ);
                        this.ʼˊ = (LinearLayout) viewGroup.findViewById(j.ˋꜞ);
                        this.ʼˊ.removeAllViews();
                        this.ʻᐝ = (LinearLayout) viewGroup.findViewById(j.ˋꞌ);
                        this.ᐝ = new DetailDownloadCard();
                        this.ᐝ.ˊ(o_dry);
                        this.ᐝ.ˏ(this.ʼᐝ.ॱॱ());
                        this.ᐝ.ˎ(this.ʼᐝ.ॱˊ());
                        this.ᐝ.ˏ(this);
                        this.ʻˋ = this.ᐝ.ˊ(layoutInflater, viewGroup2, bundle);
                        if (this.ʼᐝ.ˋ().contains("orderappdetail") && this.ʼᐝ.ᐝ() != null) {
                            this.ᐝ.ˎ(this.ʼᐝ.ᐝ());
                            this.ᐝ.ˏ(true);
                            this.ˏ.ˋ(true);
                        }
                        List arrayList = new ArrayList();
                        arrayList.add(this.ʼᐝ.ˏ());
                        this.ˏ.ˊ(arrayList);
                        linearLayout.addView(ˊ);
                        arrayList = new ArrayList();
                        arrayList.add(this.ʼᐝ.ˊ());
                        this.ᐝ.ˊ(arrayList);
                        this.ˊ.add(this.ᐝ.ॱॱ());
                        this.ʼˊ.addView(this.ʻˋ);
                        this.ᐝ.ॱ((cki) this);
                        this.ʻˊ = (NestScrollLayout) viewGroup.findViewById(j.ـˏ);
                        this.ʻˊ.setHeadView(linearLayout);
                        this.ʻˊ.setNavigatorView(this.ॱॱ);
                        this.ʻˊ.setViewPager(this.ʽ);
                        this.ʻˊ.setOnScrollListener(this);
                        this.ʻˊ.setStateListener(this);
                        ʿॱ();
                        ˋ((View) viewGroup);
                    }
                }
            }
        }
        o_dry = null;
        if (CollectCheck.isEmpty(this.ʼᐝ.ॱ())) {
            ˎ(viewGroup);
            ˎ(viewGroup, this.ʼᐝ.ॱ().size());
            if (this.ʼᐝ.ˋॱ()) {
                ˉॱ();
                ॱ(viewGroup);
            } else {
                ˊʻ();
            }
            this.ʼˋ = (LinearLayout) viewGroup.findViewById(j.ˋﾞ);
            this.ʼˊ = (LinearLayout) viewGroup.findViewById(j.ˋꜞ);
            this.ʼˊ.removeAllViews();
            this.ʻᐝ = (LinearLayout) viewGroup.findViewById(j.ˋꞌ);
            this.ᐝ = new DetailDownloadCard();
            this.ᐝ.ˊ(o_dry);
            this.ᐝ.ˏ(this.ʼᐝ.ॱॱ());
            this.ᐝ.ˎ(this.ʼᐝ.ॱˊ());
            this.ᐝ.ˏ(this);
            this.ʻˋ = this.ᐝ.ˊ(layoutInflater, viewGroup2, bundle);
            this.ᐝ.ˎ(this.ʼᐝ.ᐝ());
            this.ᐝ.ˏ(true);
            this.ˏ.ˋ(true);
            List arrayList2 = new ArrayList();
            arrayList2.add(this.ʼᐝ.ˏ());
            this.ˏ.ˊ(arrayList2);
            linearLayout.addView(ˊ);
            arrayList2 = new ArrayList();
            arrayList2.add(this.ʼᐝ.ˊ());
            this.ᐝ.ˊ(arrayList2);
            this.ˊ.add(this.ᐝ.ॱॱ());
            this.ʼˊ.addView(this.ʻˋ);
            this.ᐝ.ॱ((cki) this);
            this.ʻˊ = (NestScrollLayout) viewGroup.findViewById(j.ـˏ);
            this.ʻˊ.setHeadView(linearLayout);
            this.ʻˊ.setNavigatorView(this.ॱॱ);
            this.ʻˊ.setViewPager(this.ʽ);
            this.ʻˊ.setOnScrollListener(this);
            this.ʻˊ.setStateListener(this);
            ʿॱ();
            ˋ((View) viewGroup);
        }
    }

    private void ॱ(ViewGroup viewGroup) {
        this.ʼ = new b(this, ʽॱ());
        if (ॱˋ() instanceof AppDetailActivity) {
            this.ʼ.ˎ((AppDetailActivity) ॱˋ());
        }
        this.ʽ = (BounceViewPager) viewGroup.findViewById(j.ᐝʾ);
        this.ʽ.setAdapter(this.ʼ);
        this.ʽ.addOnPageChangeListener(new d(this.ॱॱ, this));
        this.ʽ.setCurrentItem(this.ʼᐝ.ˏॱ());
        this.ʽ.setOffscreenPageLimit(1);
        this.ʽ.setPageCount(this.ʼᐝ.ॱ().size());
    }

    private void ˊʻ() {
        if (this.ˊʻ != null) {
            this.ˊʻ.setVisibility(0);
        }
    }

    private void ˉॱ() {
        if (this.ˊʻ != null) {
            this.ˊʻ.setVisibility(8);
        }
    }

    private void ˎ(ViewGroup viewGroup) {
        this.ॱॱ = (DetailSubTabWidget) viewGroup.findViewById(j.ꜟ);
        this.ॱॱ.ˎ();
        int size = this.ʼᐝ.ॱ().size();
        for (int i = 0; i < size; i++) {
            CharSequence charSequence;
            HwSubTabWidget hwSubTabWidget;
            HwSubTabWidget.a aVar;
            DetailSubTabWidget detailSubTabWidget;
            boolean z;
            DetailColumnTabBean detailColumnTabBean = (DetailColumnTabBean) this.ʼᐝ.ॱ().get(i);
            String ˋ = detailColumnTabBean.ˋ();
            if (ˋ != null && "comment".equals(cju.ˋ(detailColumnTabBean.ॱ()))) {
                String[] split = ˋ.split("\\s+");
                if (split.length == 2) {
                    charSequence = split[0] + " (" + split[1] + ")";
                    hwSubTabWidget = this.ॱॱ;
                    hwSubTabWidget.getClass();
                    aVar = new HwSubTabWidget.a(hwSubTabWidget, charSequence, this);
                    aVar.ˎ(i);
                    detailSubTabWidget = this.ॱॱ;
                    if (i != 0) {
                        z = true;
                    } else {
                        z = false;
                    }
                    detailSubTabWidget.ॱ(aVar, z);
                }
            }
            Object obj = ˋ;
            hwSubTabWidget = this.ॱॱ;
            hwSubTabWidget.getClass();
            aVar = new HwSubTabWidget.a(hwSubTabWidget, charSequence, this);
            aVar.ˎ(i);
            detailSubTabWidget = this.ॱॱ;
            if (i != 0) {
                z = false;
            } else {
                z = true;
            }
            detailSubTabWidget.ॱ(aVar, z);
        }
    }

    public void ˏ(int i, int i2) {
        String ॱ = ((DetailColumnTabBean) this.ʼᐝ.ॱ().get(i2)).ॱ();
        ॱ(ॱ, ((DetailColumnTabBean) this.ʼᐝ.ॱ().get(i2)).ˋ());
        ॱॱ(i);
        this.ˎ = dgh.ॱ();
        evr.ˊ().ᐝ();
        if ("comment".equals(cju.ˋ(ॱ))) {
            boolean z = false;
            try {
                String str;
                if (!TextUtils.isEmpty(this.ʼᐝ.ˊ().ॱـ())) {
                    z = ((cdg) cdb.ॱ(cdg.class)).ॱॱ(this.ʼᐝ.ˊ().ॱـ());
                }
                if (z) {
                    str = "02";
                } else {
                    str = KeyAndValue.NUMBER_01;
                }
                dgh.onEvent(new o.dge.d(ॱˋ(), n.ˏˎ).ˏ(str + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + this.ʼᐝ.ˊ().ͺˏ()).ˋ());
            } catch (Throwable th) {
                Logger.ˋ("AppDetailFragment", HwAccountConstants.EXTRA_OPLOG_ERROR, th);
            }
        } else if ("introduce".equals(cju.ˋ(ॱ))) {
            evr.ˊ().ˋ(this.ʻˊ);
        }
        ˊ(this.ʼᐝ.ˊ().ͺˏ(), ((DetailColumnTabBean) this.ʼᐝ.ॱ().get(i2)).ॱ());
        ety.ˊ().ˋ(ॱ);
    }

    private void ʻ(int i) {
        if (this.ʼ != null && this.ʽ != null && ʾ()) {
            if (i == this.ˊʼ) {
                Fragment fragment = null;
                if (this.ˉॱ != null) {
                    fragment = (Fragment) this.ˉॱ.get();
                }
                if (fragment == null) {
                    List<Fragment> ˏ = ʽॱ().ˏ();
                    if (ˏ != null) {
                        for (Fragment fragment2 : ˏ) {
                            if (fragment2 instanceof cjb) {
                                break;
                            }
                        }
                    }
                }
                Fragment fragment22 = fragment;
                if ((fragment22 instanceof cjb) && ((cjb) fragment22).ˋ(this.ʻᐝ)) {
                    ʽᐝ();
                    return;
                } else {
                    Logger.ˋ("AppDetailFragment", "can not find IDetailBottomController instance.");
                    return;
                }
            }
            ʽˊ();
        }
    }

    private void ˎ(ViewGroup viewGroup, int i) {
        int i2 = 4;
        if (i == 1) {
            this.ॱॱ.setVisibility(8);
        } else if (epr.ˎ().ॱॱ()) {
            if (i > 4) {
                i2 = i;
            }
            Context context = viewGroup.getContext();
            int ʽ = epv.ʽ(context);
            i2 = ((ʽ - (((ʽ - (context.getResources().getDimensionPixelSize(o.ewm.d.ﾞ) * 2)) / i2) * i)) / 2) - context.getResources().getDimensionPixelSize(o.ewm.d.ᶥ);
            this.ॱॱ.setPadding(i2, this.ॱॱ.getPaddingTop(), i2, this.ॱॱ.getPaddingBottom());
        }
    }

    private void ʿॱ() {
        this.ʻˊ.setImmerse(true);
        if (this.ʼᐝ.ʼ() == 1) {
            if (this.ʿॱ != null) {
                this.ʿॱ.ॱ(this.ʼᐝ.ʼ(), CSSStyleSheet.parse(this.ʼᐝ.ʻ()), this.ʼᐝ.ʽ());
            }
            this.ʻˋ.setBackgroundColor(this.ﾟ);
            this.ᐝ.ˎ(true);
            if (this.ˏ != null) {
                this.ˏ.ॱ(true);
                this.ˏ.ʽ();
            }
        } else if (this.ˏ != null) {
            this.ˏ.ʼ();
        }
    }

    private void ॱ(String str, String str2) {
        chp.ˋ(new o.chr.e().ˊ(str).ˎ(str2).ˏ(String.valueOf(dgm.ˎ(ॱˋ()))).ˎ());
    }

    private void ॱॱ(int i) {
        String ˋ = cju.ˋ(((DetailColumnTabBean) this.ʼᐝ.ॱ().get(i)).ॱ());
        if (!dgm.ˏ(ॱˋ())) {
            if (ʾ()) {
                if ("introduce".equals(ˋ)) {
                    ˋ = ॱ(n.ᐝˊ);
                } else if ("comment".equals(ˋ)) {
                    ˋ = ॱ(n.ـ);
                }
            }
            ˋ = null;
        } else if ("introduce".equals(ˋ)) {
            ˋ = "01091003";
        } else {
            if ("comment".equals(ˋ)) {
                ˋ = "01090603";
            }
            ˋ = null;
        }
        if (ˋ != null) {
            dgh.ˋ(ॱˋ(), ˋ, this.ˎ);
        }
    }

    public int ॱ() {
        if (this.ॱॱ != null) {
            return this.ॱॱ.ˊ();
        }
        return -1;
    }

    private void ˊ(String str, String str2) {
        String str3;
        if ("comment".equals(cju.ˋ(str2))) {
            str3 = "2";
        } else {
            str3 = "1";
            str = str2;
        }
        cgo.ˋ(str3, str, dgm.ˎ(ॱˋ()));
    }

    public void ˌ() {
        this.ˎ = dgh.ॱ();
        if (this.ˏ != null) {
            this.ˏ.ॱ();
        }
        if (this.ᐝ != null) {
            this.ᐝ.ॱ();
        }
        super.ˌ();
    }

    public void ˋᐝ() {
        try {
            this.ˏ.ˏ();
            this.ᐝ.ˏ();
            if (this.ॱॱ != null) {
                ॱॱ(this.ॱॱ.ˊ());
            }
        } catch (Throwable e) {
            Logger.ˋ("AppDetailFragment", "onPause error", e);
        }
        super.ˋᐝ();
        evr.ˊ().ᐝ();
    }

    public void ᐝ() {
        this.ˊ.clear();
        try {
            ॱˋ().unregisterReceiver(this.ˋ);
            ll ˏ = ll.ˏ(ॱˋ());
            ˏ.ˋ(this.ˈॱ);
            ˏ.ˋ(this.ॱ);
        } catch (IllegalStateException e) {
            Logger.ˋ("AppDetailFragment", "onDestroyView error" + e.toString());
        } catch (IllegalArgumentException e2) {
            Logger.ˋ("AppDetailFragment", "onDestroyView error" + e2.toString());
        } catch (Exception e3) {
            Logger.ˋ("AppDetailFragment", "onDestroyView error" + e3.toString());
        }
        eoj.ˋ().ˊ("APP_DETAIL_LOGIN_KEY");
        try {
            this.ˏ.ˊ();
            this.ᐝ.ˊ();
        } catch (Throwable e4) {
            Logger.ˋ("AppDetailFragment", "onDestroyView error", e4);
        }
        ˊʼ();
        ˉॱ();
        super.ᐝ();
    }

    private void ˊʼ() {
        this.ˏ = null;
        this.ʻˊ = null;
        this.ᐝ = null;
    }

    public void ˋ(int i) {
        evr.ˊ().ˎ(this.ʻˊ);
    }

    public void ˋ() {
        dmq.ॱ.ˊ(new e());
    }

    public List<DetailColumnTabBean> ʾॱ() {
        return this.ʼᐝ.ॱ();
    }

    public void ॱ(Activity activity) {
        super.ॱ(activity);
        if (activity instanceof dhr) {
            this.ʿॱ = (dhr) activity;
        }
    }

    public boolean ʼᐝ() {
        if (!(this.ʼ == null || this.ʽ == null)) {
            int ˋ = this.ʽ.getCurrentItem();
            if (MinimumFactory.getBoolValue(ContentManager.getInstant().getContext())) {
                ˋ = (this.ʼ.getCount() - 1) - ˋ;
            }
            Object ॱ = this.ʼ.instantiateItem(this.ʽ, ˋ);
            if (ॱ instanceof ciz) {
                return ((ciz) ॱ).ad_();
            }
            Logger.e("AppDetailFragment", "unknown type, fragment:" + ॱ + ", uri:" + this.ʼᐝ.ˋ());
        }
        return false;
    }

    public void ˋ(int i, int i2) {
        if (this.ʿॱ != null) {
            this.ʿॱ.ˋ(i, i2);
        }
    }

    public void ˊ(HwSubTabWidget.a aVar, FragmentTransaction kaVar) {
        if (this.ʼ != null) {
            Fragment ˊ = this.ʼ.ˊ();
            if (ˊ != null && (ˊ instanceof ciy)) {
                ((ciy) ˊ).ʾॱ();
            }
        }
    }

    public void ˎ(HwSubTabWidget.a aVar, FragmentTransaction kaVar) {
        if (this.ॱॱ != null) {
            int ˊ = this.ॱॱ.ˊ();
            if (this.ʽ != null) {
                this.ʽ.setCurrentItem(ˊ);
            }
        }
    }

    public void ॱ(HwSubTabWidget.a aVar, FragmentTransaction kaVar) {
    }

    public void ʽˊ() {
        if (this.ʼˊ != null && this.ʼˊ.getVisibility() != 0 && this.ʻˊ != null && this.ʽ != null) {
            this.ʼˊ.setVisibility(0);
            this.ʻᐝ.setVisibility(8);
        }
    }

    public void ʽᐝ() {
        if (this.ʼˊ != null && this.ʼˊ.getVisibility() != 8 && this.ʻˊ != null && this.ʽ != null) {
            this.ʼˊ.setVisibility(8);
            this.ʻᐝ.setVisibility(0);
        }
    }

    public void ˋ(@NonNull Bundle bundle) {
        bundle.putInt("extend_fragment_position", this.ˊʼ);
        super.ˋ(bundle);
    }
}
